<template>
  <div>
    <van-nav-bar
      title="城市列表"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    >
    </van-nav-bar>

    <van-index-anchor>当前城市</van-index-anchor>
    <van-cell title="上海"> </van-cell>
    <van-index-anchor>热门城市</van-index-anchor>
    <van-cell v-for="item in hotcitylist" :key="item.value" :title="item.label">
    </van-cell>

    <van-index-bar v-for="item in citysList" :key="item.value">
      <van-index-anchor :index="A" />
      <van-cell :title="item.label"></van-cell>
    </van-index-bar>
  </div>
</template>

<script>
// import { gethotCities } from '@/api/houseInfo'
import axios from 'axios'
export default {
  name: 'city-message',
  props: {},
  components: {},
  data () {
    return {
      citysList: [],
      hotcitylist: []
    }
  },
  async created () {
    // 获取城市列表数据
    const { data } = await axios.get('http://liufusong.top:8080/area/city', {
      params: {
        level: 1
      }
    })
    // console.log(data.body)
    this.citysList = data.body
  },

  methods: {
    // 返回上一步
    onClickLeft () {
      this.$router.go(-1)
    },
    // 获取热门城市列表
    async getCities () {
      const { data } = await axios.get('http://liufusong.top:8080/area/hot')
      console.log(data.body)
      this.hotcitylist = data.body
    }
  },
  mounted () {},
  watch: {},
  computed: {},
  filters: {}
}
</script>

<style scoped lang="less"></style>
